/*
 * FileClient.cpp
 *
 *  Created on: 30.03.2011
 *      Author: niea
 */

#include "FileClient.hpp"
#include <cstdlib>

namespace efs
{

FileClient::FileClient()
{
}

FileClient::~FileClient()
{
}

bool FileClient::getFile(ClientEntry entry,
		std::string const &remote_root,
		std::string const &remote_file_path,
		std::string const &local_file_path)
{
	std:: string req = std::string("wget --no-proxy  -T 1 -t 1 \"http://" + entry.ip + ":" + intToStr(entry.file_port) + "/"
			+ remote_file_path + "\" -O \"" + local_file_path + remote_file_path + "\"");
	pantheios::log_DEBUG("[FileClient]: " + req);
	int res = system(req.c_str());
	if (res == 0)
	{
		return true;
	}
	else
	{
		return false;
	}
}

}
